import Http from "../http";

export async function strategyPageApi(params:any) {
    const { data } = await Http.get('strategy/show_strategy/', params)
    return data
}

export async function myStrategyPageApi(params:any) {
    const { data } = await Http.get('strategy/show_subscribe/', params)
    return data
}

export async function strategyApi(id:number|any) {
    if(typeof id == 'number') {
        return await Http.get(`strategy/detail/?strategy_id=${id}`)
    }else {
        return await Http.get(`strategy/detail/`, id)
    }
    
}

export function strategyBackTestApi(params:any) {
    return Http.post('strategy/backtest/run', params)
}



export function strategyBackTestProcessApi(taskId:number) {
    return Http.get('strategy/backtest/process?task_id=' + taskId)
}


export async function combinationBackTestPageApi(params:any) {
    const { data } = await Http.get('strategy/batchtest/list', params)
    return data
}

export async function strategyTradeStartApi(params:any) {
    const { data } = await Http.get('strategy/trade/start', params)
    return data
}

export function strategyTradeRunApi(params:any) {
    return Http.post('strategy/trade/run', params)
}